package com.sans.consumer.controller;

import com.sans.base.dto.ProviderDTO;
import com.sans.base.service.IProviderService;
import com.sans.base.vo.ResultVO;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * 消费测试接口
 * @author zhang
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    /**
     * Dubbo远程调用注解
     * */
    @Reference
    private IProviderService providerService;

    @GetMapping ("/list")
    public ResultVO getList(){
        // 远程调用
        List<ProviderDTO> providerDTOList = providerService.queryList();
        return new ResultVO.Builder().code(200).message("success").data(providerDTOList).build();
    }
}